class Solution:
    def addDigits(self, num: int) -> int:
        while True:
            if num < 10:
                return num
            num_s = str(num)
            num = 0
            for it in num_s:
                num += int(it)
